package extend;

/**
 * 策略枚举
 *
 * @author gaopeng
 * @date 2019/12/14 9:47 下午
 */
public enum StrategyEnum {
    ADD("+") {
        @Override
        public int exec(int a, int b) {
            return a + b;
        }
    },
    SUB("-") {
        @Override
        public int exec(int a, int b) {
            return a - b;
        }
    };

    private String symbol;

    StrategyEnum(String symbol) {
        this.symbol = symbol;
    }

    public String getSymbol() {
        return symbol;
    }

    public abstract int exec(int a, int b);
}
